VPATH = src:ppd:bin

ppds = CMP-30.ppd.gz

DEFS=
LIBS=-lcupsimage -lcups

ifdef RPMBUILD
DEFS=-DRPMBUILD
LIBS=-ldl
endif

define dependencies
@if [ ! -e /usr/include/cups ]; then echo "CUPS headers not available - exiting"; exit 1; fi
@if ! (ls /usr/lib | grep libcups.* > /dev/null); then echo "libcups not available - exiting"; exit 1; fi
@if ! (ls /usr/lib | grep libcupsimage.* > /dev/null); then echo "libcupsimage not available - exiting"; exit 1; fi
endef

# define init
# @if [ ! -e bin ]; then echo "mkdir bin"; mkdir bin; fi
# endef

.PHONY: install
install: $(ppds)
	@if [ ! -e install ]; then echo "Please run make package first."; exit 1; fi
	# installing
	cp ppd/*.gz install
	cd install; exec ./setup

.PHONY: remove
remove:
	#removing from default location (other locations require manual removal)
	@if [ -e /usr/lib/cups/filter/rastertolkp30 ]; then echo "Removing rastertolkp30"; rm -f /usr/lib/cups/filter/rastertolkp30; fi
	@if [ -d /usr/share/cups/model/CMP30 ]; then echo "Removing dir .../cups/model/CMP30"; rm -rf /usr/share/cups/model/CMP30; fi

.PHONY: help
help:
	# Help for starcupsdrv make file usage
	#
	# command          purpose
	# ------------------------------------
	# make install      execute the setup shell script from the install directory [require root user permissions]
	# make remove       removes installed files from your system (assumes default install lication) [requires root user permissions]

$(ppds): %.ppd.gz: %.ppd
	# gzip ppd file
	gzip -c $< >> ppd/$@

